//显示登录模态框
function showLoginModal()
{
	$(".login").show();

}

//显示注册模态框
function showRegModal()
{
	$('.reg').show();
}

//登录
function login(bt)
{
	$(bt).attr('disabled',true);
	var data = $(bt).parents('form').eq(0).serialize();
	$.ajax(
	{
		url:'?m=Home&c=Login&a=login',
		data:data,
		type:'POST',
		dataType:'JSON',
		success:function(result)
		{
			if(result.errcode==0)
			{
				location.href=result.data;
			}
			else
			{
				//有错误
				alert(result.message);
			}

			$(bt).removeAttr('disabled');
		}
	})

}

//注册
function reg(bt)
{
	$(bt).attr('disabled',true);
	var data = $(bt).parents('form').eq(0).serialize();
	$.ajax(
	{
		url:'?m=Home&c=Login&a=reg',
		data:data,
		type:'POST',
		dataType:'JSON',
		success:function(result)
		{
			//{errcode:0,message:'xxx',data={url:'xx'}}
			if(result.errcode==0)
			{
				// alert(result.message);
				location.href=result.data;
			}
			else
			{
				//有错误
				alert(result.message);
			}

			$(bt).removeAttr('disabled');
		}
	})

}







